//
//  HJTeamInvitation.m
//  project
//
//  Created by hu on 2019/4/4.
//  Copyright © 2019 健健. All rights reserved.
//

#import "HJTeamInvitation.h"
#import "HJChatTextMsgModel.h"

@interface HJTeamInvitation ()<UITextViewDelegate,UITextFieldDelegate>

@end

@implementation HJTeamInvitation

-(void)awakeFromNib {
    [super awakeFromNib];
    [self setupShadowWithView:self.bgView];
//    [self.timeView rounded:UIRectCornerAllCorners radius:8 borderColor:[UIColor colorWithHex:0xe5e5e5] borderWidth:1];
//    [self.locationView rounded:UIRectCornerAllCorners radius:8 borderColor:[UIColor colorWithHex:0xe5e5e5] borderWidth:1];
//    [self.pathView rounded:UIRectCornerAllCorners radius:8 borderColor:[UIColor colorWithHex:0xe5e5e5] borderWidth:1];
    self.meetingTime_TF.delegate = self;
    self.meetingLocation_TF.delegate = self;
}

-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
    switch (textField.tag) {
        case 10101:
        {
            if ([self.delegate respondsToSelector:@selector(meetingTimeWithTextField:timeLabel:)]) {
                [self.delegate meetingTimeWithTextField:textField timeLabel:self.timeLabel];
            }
        }
            break;
        case 10102:
        {
            if ([self.delegate respondsToSelector:@selector(meetingLocationWithTextField:locationLabel:)]) {
                [self.delegate meetingLocationWithTextField:textField locationLabel:self.locationLabel];
            }
        }
            break;
        case 10103:
        {
            if ([self.delegate respondsToSelector:@selector(meetingPathWithTextField:)]) {
                [self.delegate meetingPathWithTextField:textField];
            }
        }
            break;
        default:
            break;
    }
    return NO;
}
// H=341
-(instancetype)init {
    if (self == [super init]) {
        self = [[NSBundle mainBundle]loadNibNamed:@"HJTeamInvitation" owner:nil options:nil].lastObject;
    }
    return self;
}
//- (void)textViewDidEndEditing:(UITextView *)textView {
//    NSRange rang = NSMakeRange(0, textView.text.length);
//    if ([textView.text isEqualToString:@""] && rang.length == 0) {
//        self.placeHolder.hidden = NO;
//    }
//}
//-(BOOL)textViewShouldBeginEditing:(UITextView *)textView {
//    self.placeHolder.hidden = YES;
//    return YES;
//}
-(void)textViewDidChange:(UITextView *)textView {
    
}

-(void)setTeamInvitionType:(NSUInteger)TeamInvitionType {
    
}
-(void)timeEditDidClicked {
    if ([self.delegate respondsToSelector:@selector(meetingTimeWithTextField:timeLabel:)]) {
        [self.delegate meetingTimeWithTextField:self.meetingTime_TF timeLabel:self.timeLabel];
    }
}
-(void)locationEditDidClicked {
    if ([self.delegate respondsToSelector:@selector(meetingLocationWithTextField:locationLabel:)]) {
        [self.delegate meetingLocationWithTextField:self.meetingLocation_TF locationLabel:self.locationLabel];
    }
}



#pragma mark --给UI赋值

-(void)setSimpleModel:(HJSimpleModel *)simpleModel {
    _simpleModel = simpleModel;
    self.timeLabel.text = simpleModel.data.team.startTime;
    self.locationLabel.text = simpleModel.data.team.startText;
}
@end
